package gases.as3.testing
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.utils.setTimeout;
	
	import gases.as3.librarys.compnents.events.GDataGridEvent;
	import gases.as3.librarys.compnents.ui.control.datagrid.GDataGrid;
	
	public class TestingGDatagrid extends Sprite
	{
		public function TestingGDatagrid()
		{
			super();
			init();
			
		}
		
		private function init():void
		{
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			
			var datagrid:GDataGrid = new GDataGrid();
			datagrid.setDataHead(title,null,[100,120,130]);
			datagrid.dataProvider(data,colorArr,widthArr,heightArr);
			this.addChild(datagrid);
			datagrid.addEventListener(GDataGridEvent.ITEM_CLICK,itemClick);
			
			setTimeout(test,5000);
			
			function test():void
			{
				datagrid.dataProvider(data_test,colorArr,widthArr,heightArr);
				datagrid.setDataHead(title_test,null,[100,120,130]);
			}
		}
		
		
		private function itemClick(e:GDataGridEvent):void
		{
			trace(e.data);
			trace(e.index);
		}
		
		
		private var title:Array = ["id","name","desc"];
		
		private var title_test:Array = ["id_test","name_test","desc_test"];
		
		private var data:Array = [["001","name001","desc001"],
			["002","name002","desc002"],
			["003","name003","desc003"]];
		private var data_test:Array = [["0001","name0001","desc0001"],
			["0002","name0002","desc0002"],
			["0003","name0003","desc0003"]];
		
		private var colorArr:Array = [[0xFFFFFF,0xFFFFFF,0xFFFFFF],
			[0xdddddd,0xdddddd,0xdddddd],
			[0x000000,0x000000,0x000000]];
		
		private var widthArr:Array = [[100,120,130],
			[100,120,130],
			[100,120,130]];
		
		private var heightArr:Array = [25,30,45];
		
		
	}
}